package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.OrrOutcupDifferenceAnalysisService;
import com.yunhai.model.entity.orr.OrrOutcupDifferenceAnalysisEntity;
import com.yunhai.model.vo.orr.OrrOutcupDifferenceAnalysisQuery;
import com.yunhai.model.vo.orr.OrrOutcupDifferenceAnalysisVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/orrOutcupDifferenceAnalysis")
public class OrrOutcupDifferenceAnalysisController {

	@Resource
	private OrrOutcupDifferenceAnalysisService orrOutcupDifferenceAnalysisService;


	/**
	 * 获取 OrrOutcupDifferenceAnalysis 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getOrrOutcupDifferenceAnalysisPagination(PaginationVo paginationVo, OrrOutcupDifferenceAnalysisQuery orrOutcupDifferenceAnalysisQuery ) throws Exception {
		IPage page = orrOutcupDifferenceAnalysisService.getOrrOutcupDifferenceAnalysisPagination(paginationVo, orrOutcupDifferenceAnalysisQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 OrrOutcupDifferenceAnalysis 所有数据
	 */
	@GetMapping("/allList")
	public Ret getOrrOutcupDifferenceAnalysisAllList( OrrOutcupDifferenceAnalysisQuery orrOutcupDifferenceAnalysisQuery ) throws Exception {
		List<OrrOutcupDifferenceAnalysisEntity> list = orrOutcupDifferenceAnalysisService.getOrrOutcupDifferenceAnalysisAllList( orrOutcupDifferenceAnalysisQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 OrrOutcupDifferenceAnalysis 详情
	 */
	@GetMapping("/{id}")
	public Ret getOrrOutcupDifferenceAnalysisDetailById(@PathVariable Long id) throws Exception {

	    OrrOutcupDifferenceAnalysisEntity orrOutcupDifferenceAnalysisEntity = orrOutcupDifferenceAnalysisService.getOrrOutcupDifferenceAnalysisDetail(id);
		return Ret.ok(orrOutcupDifferenceAnalysisEntity);
	}


	/**
	 * 新增 OrrOutcupDifferenceAnalysis
	 * */
	@PostMapping("")
	public Ret addOrrOutcupDifferenceAnalysis(@RequestBody OrrOutcupDifferenceAnalysisVo orrOutcupDifferenceAnalysisVo) throws Exception {

		orrOutcupDifferenceAnalysisService.addOrrOutcupDifferenceAnalysis(orrOutcupDifferenceAnalysisVo);
		return Ret.ok();
	}


	/**
	 * 更新 OrrOutcupDifferenceAnalysis
	 * */
	@PutMapping("")
	public Ret updateOrrOutcupDifferenceAnalysis(@RequestBody OrrOutcupDifferenceAnalysisVo orrOutcupDifferenceAnalysisVo) throws Exception {

		orrOutcupDifferenceAnalysisService.updateOrrOutcupDifferenceAnalysis(orrOutcupDifferenceAnalysisVo);
		return Ret.ok();
	}


	/**
	 * 删除 OrrOutcupDifferenceAnalysis
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveOrrOutcupDifferenceAnalysis( @RequestBody List<Long> ids ) throws Exception {

	    orrOutcupDifferenceAnalysisService.batchRemoveOrrOutcupDifferenceAnalysis(ids);
		return Ret.ok();
	}
}
